.TH std::numeric_limits::denorm_min 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::numeric_limits::denorm_min \- std::numeric_limits::denorm_min

.SH Synopsis
   static T denorm_min() throw();             \fI(until C++11)\fP
   static constexpr T denorm_min() noexcept;  \fI(since C++11)\fP

   Returns the minimum positive subnormal value of the type T, if
   std::numeric_limits<T>::has_denorm != std::denorm_absent, otherwise returns
   std::numeric_limits<T>::min() for floating point types and T() for all other types.
   Only meaningful for floating-point types.

.SH Return value

   T                                    std::numeric_limits<T>::denorm_min()
   /* non-specialized */                T()
   bool                                 false
   char                                 0
   signed char                          0
   unsigned char                        0
   wchar_t                              0
   char8_t \fI(since C++20)\fP                0
   char16_t \fI(since C++11)\fP               0
   char32_t \fI(since C++11)\fP               0
   short                                0
   unsigned short                       0
   int                                  0
   unsigned int                         0
   long                                 0
   unsigned long                        0
   long long \fI(since C++11)\fP              0
   unsigned long long since (since      0
   C++11)
                                        FLT_TRUE_MIN (\\(\\scriptsize 2^{-149}\\)2-149
   float                                if
                                        std::numeric_limits<float>::is_iec559 is true)
                                        DBL_TRUE_MIN (\\(\\scriptsize 2^{-1074}\\)2-1074
   double                               if
                                        std::numeric_limits<double>::is_iec559 is true)
   long double                          LDBL_TRUE_MIN

.SH Example

   Demonstates the underlying bit structure of the denorm_min() and prints the values:


// Run this code

 #include <cassert>
 #include <cstdint>
 #include <cstring>
 #include <iostream>
 #include <limits>

 int main()
 {
     // the smallest subnormal value has sign bit = 0, exponent = 0
     // and only the least significant bit of the fraction is 1
     std::uint32_t denorm_bits = 0x0001;
     float denorm_float;
     std::memcpy(&denorm_float, &denorm_bits, sizeof(float));

     assert(denorm_float == std::numeric_limits<float>::denorm_min());

     std::cout << "float\\tmin()\\t\\tdenorm_min()\\n";
     std::cout << "\\t" << std::numeric_limits<float>::min() << '\\t';
     std::cout <<         std::numeric_limits<float>::denorm_min() << '\\n';

     std::cout << "double\\tmin()\\t\\tdenorm_min()\\n";
     std::cout << "\\t" << std::numeric_limits<double>::min() << '\\t';
     std::cout <<         std::numeric_limits<double>::denorm_min() << '\\n';
 }

.SH Possible output:

 float   min()           denorm_min()
         1.17549e-38     1.4013e-45
 double  min()           denorm_min()
         2.22507e-308    4.94066e-324

.SH See also

   min              returns the smallest finite value of the given type
   \fB[static]\fP         \fI(public static member function)\fP
   has_denorm       identifies the denormalization style used by the floating-point
   \fB[static]\fP         type
                    \fI(public static member constant)\fP
   lowest           returns the lowest finite value of the given type
   \fB[static]\fP \fI(C++11)\fP \fI(public static member function)\fP
